#pragma once

#include "../umlmodel_global.h"

#include <memory>
#include <vector>

#include "BehavioredClassifier.h"
#include "Classifier.h"

using std::make_shared;
using std::shared_ptr;
using std::vector;

namespace uml {
class Classifier;
class Extend;
class ExtensionPoint;
class Include;

/// <summary>
/// UseCase
/// A UseCase specifies a set of actions performed by its subjects, which yields an
/// observable result that is of value for one or more Actors or other stakeholders
/// of each subject.
/// </summary>
class UMLMODEL_EXPORT UseCase : public Classifier, public BehavioredClassifier {

public: // Constructors and destructors
    explicit UseCase(const QString& umlType="uml::UseCase");

public: // JsonSerializable override
    void fromJson(const QJsonObject& json, QStringList& errorList) override;
    void toJson(QJsonObject& json) override;

public: // Methods
    /// <summary>
    /// allIncludedUseCases
    /// The query allIncludedUseCases() returns the transitive closure of all UseCases
    /// (directly or indirectly) included by this UseCase.
    /// </summary>
    virtual shared_ptr<vector<UseCase>> allIncludedUseCases() const;

public: // Properties
    /// <summary>
    /// extends getter
    /// The Extend relationships owned by this UseCase.
    /// </summary>
    vector<shared_ptr<Extend>>& extends();

    /// <summary>
    /// extensionPoints getter
    /// The ExtensionPoints owned by this UseCase.
    /// </summary>
    vector<shared_ptr<ExtensionPoint>>& extensionPoints();

    /// <summary>
    /// includes getter
    /// The Include relationships owned by this UseCase.
    /// </summary>
    vector<shared_ptr<Include>>& includes();

    /// <summary>
    /// subjects getter
    /// The subjects to which this UseCase applies. Each subject or its parts realize
    /// all the UseCases that apply to it.
    /// </summary>
    vector<shared_ptr<Classifier>>& subjects();

private: // Fields
    /// <summary>
    /// extends
    /// The Extend relationships owned by this UseCase.
    /// </summary>
    vector<shared_ptr<Extend>> extends_;

    /// <summary>
    /// extensionPoints
    /// The ExtensionPoints owned by this UseCase.
    /// </summary>
    vector<shared_ptr<ExtensionPoint>> extensionPoints_;

    /// <summary>
    /// includes
    /// The Include relationships owned by this UseCase.
    /// </summary>
    vector<shared_ptr<Include>> includes_;

    /// <summary>
    /// subjects
    /// The subjects to which this UseCase applies. Each subject or its parts realize
    /// all the UseCases that apply to it.
    /// </summary>
    vector<shared_ptr<Classifier>> subjects_;

};

} // namespace uml
